home *** CD-ROM | disk | FTP | other *** search
/ NeXT Enterprise Objects Framework 1.1 / NeXT Enterprise Objects Framework 1.1.iso / NextDeveloper / Examples / EnterpriseObjects / DistributedEO / DEOServer.tproj / DEOServer_main.m < prev    next >
Encoding:
Text File  |  1995-02-17  |  996 b   |  36 lines

  1. /*
  2.    DEOServer_main.m created by enoyau on Fri 13-Jan-1995
  3.  
  4.    You may freely copy, distribute, and reuse the code in this example.
  5.    NeXT disclaims any warranty of any kind, expressed or implied, as to its
  6.    fitness for any particular use.
  7. */
  8.  
  9. #import "DEOServer.h"
  10.  
  11. #import <foundation/NSAutoreleasePool.h>
  12. #import <foundation/NXAutoreleaseConnection.h>
  13.  
  14. #import <machkit/NXPort.h>
  15.  
  16. #define SECOND (1000)
  17. #define MINUTE (60 * SECOND)
  18.  
  19. int main(int argc, char *argv[]) {
  20.     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  21.     DEOServer *myServer = [[[DEOServer alloc] init] autorelease];
  22.     NXAutoreleaseConnection *myConnection = [NXAutoreleaseConnection registerRoot:myServer withName:DEOServerName];
  23.  
  24.     [NXPort worryAboutPortInvalidation];
  25. //    [myConnection registerForInvalidationNotification:myServer];
  26.  
  27.     do {
  28.         [myConnection runWithTimeout:2 * MINUTE];
  29.         
  30.     } while([myServer hasClient]);
  31.  
  32.     [myConnection free];
  33.     [pool release];
  34.     return 0;
  35. }
  36.